package com.wanczy.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wanczy.mapper.AdminMapper;
import com.wanczy.pojo.Admin;
import com.wanczy.pojo.GoodsAndShop;
import com.wanczy.pojo.Shop;
import com.wanczy.pojo.User;
import com.wanczy.service.AdminService;

@Service
public class AdminServiceImpl implements AdminService {
	@Autowired
	private AdminMapper adminMapper;
	@Override
	public Admin findByPassAndName(String adminName, String adminPass) {
		Admin admin = adminMapper.findByPassAndName(adminName, adminPass);
		return admin;
	}
	@Override
	public List<User> findByNameLike(String userName) {
		List<User> list = adminMapper.findByNameLike("%"+userName+"%");
		return list;
	}
	@Override
	public List<Shop> findByShopName(String shopName) {
		List<Shop> list = adminMapper.findByShopName("%"+shopName+"%");
		return list;
	}
	@Override
	public boolean updShop(Integer shopId, Integer shopState) {
		boolean flag = adminMapper.updShop(shopId, shopState);
		return flag;
	}
	@Override
	public boolean updUser(Integer userId, Integer userState) {
		boolean flag = adminMapper.updUser(userId, userState);
		return flag;
	}
	@Override
	public List<GoodsAndShop> findByGoodsName(String goodsName) {
		List<GoodsAndShop> list = adminMapper.findByGoodsName("%"+goodsName+"%");
		return list;
	}
	@Override
	public boolean updGoods(Integer goodsId, Integer goodsState) {
		boolean flag = adminMapper.updGoods(goodsId, goodsState);
		return flag;
	}
}
